﻿@{
    ViewBag.Title = "AddAdvertise";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

@section scripts
{
    <script src="~/Scripts/App/Admin/advertise-add.js" type="text/javascript"></script>
}

<div class="content-header">
    <div class="header-section">
        <h1>
            <i class="gi gi-certificate"></i>Quản Lý Quảng Cáo<br>
            <small>Tạo Mới Quảng Cáo</small>
        </h1>
    </div>
</div>
<ul class="breadcrumb breadcrumb-top">
    <li><a href="../Admin/index"><i class="fa fa-home"></i></a></li>
    <li><a href="../Admin/ListAdvertise">Quảng Cáo</a></li>
    <li><a href="../Admin/AddAdvertise">Tạo Mới</a></li>
</ul>
<div class="block block-alt-noborder" id="top-addad">
    <div id="upload-step1">
        <form id="ad-info" class="form-horizontal form-bordered" novalidate="novalidate">
            <div class="form-group">
                <label for="val_title" class="col-md-4 control-label">Tên Quảng Cáo<span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <input type="text" data-bind="value: Title" placeholder="Chứa ít nhất 2 ký tự..." class="form-control" name="val_title" id="val_title">
                        <span class="input-group-addon"><i class="gi gi-nameplate"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_pname" class="col-md-4 control-label">Tên Sản Phẩm <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <input type="text" placeholder="vd: Cocacola" data-bind="value: ProductName" class="form-control" name="val_pname" id="val_pname">
                        <span class="input-group-addon"><i class="gi gi-playing_dices"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_mediatype" class="col-md-4 control-label">Định Dạng <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <select id="val_mediatype" name="val_mediatype" class="select-chosen" data-placeholder="Chọn định dạng..." data-bind="options: cbbMediatypes, optionsValue: 'MediaTypeId', optionsText: 'Name', value: MediaTypeId, chosen: true">
                        </select>
                        <span class="input-group-addon"><i class="gi gi-asterisk"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_publisher" class="col-md-4 control-label">Người Đăng <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <select id="val_publisher" name="val_publisher" class="select-chosen" data-placeholder="Chọn người đăng quảng cáo..." data-bind="options: cbbPublishers, optionsValue: 'PubId', optionsText: 'UserName', value: PublisherId, chosen: true">
                        </select>
                        <span class="input-group-addon"><i class="gi gi-user"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_categories" class="col-md-4 control-label">Loại Quảng Cáo <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <select id="val_categories" name="val_categories" multiple="multiple" class="select-chosen" data-placeholder="Chọn loại QC..." data-bind="options: cbbCategories, optionsValue: 'CatId', optionsText: 'Name', selectedOptions: selectedCategories, chosen: true">
                        </select>
                        <span class="input-group-addon"><i class="gi gi-tags"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_prethum" class="col-md-4 control-label">Hình Xem Trước <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <img id="prethum" height="187" width="300" src="~/Advertise/DefaultAssets/defaultPreview.jpg" alt="Preview Thumbail">
                    <div class="input-group">
                        <input accept="image/*" type="file" data-bind="ThumUpload: { property: 'PreviewImg', url: '/api/AdminAdv/PostPreviewThum' }" class="form-control" name="val_prethum" id="val_prethum">
                        <span class="input-group-addon"><i class="gi gi-playing_dices"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_prethum" class="col-md-4 control-label">Mô Tả Ngắn <span class="text-danger">*</span></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <textarea placeholder="Tóm tắt mô tả sản phẩm" data-bind="value: ShortDes" class="form-control" name="val_shortdes" id="val_shortdes" rows="6"></textarea>
                        <span class="input-group-addon"><i class="gi gi-playing_dices"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="val_prethum" class="col-md-12 text-center">Mô Tả Chi Tiết</label>
                <div class="col-md-10 col-md-offset-1">
                    <textarea class="form-control ckeditor" name="val_description" id="ckeditor-des" rows="6"></textarea>
                </div>
            </div>
            <div class="form-actions form-group">
                <div class="col-md-8 col-md-offset-4">
                    <button class="btn btn-sm btn-primary" id="btn_submit" type="submit">Tiếp Tục</button>
                    <a href="ListAdvertise" class="btn btn-sm btn-warning">Danh Sách</a>
                </div>
            </div>
        </form>
    </div>
    <div style="display: none;" id="upload-step2-img">
        <div id="imagesfileupload">Select Images</div>
        <div class="form-actions form-group">
            <button type="button" class="btn btn-sm btn-default" onClick="window.location.reload()">Tải Lại Trang</button>
            <button class="btn btn-sm btn-primary" id="btn_up-img" type="button" data-bind="click: $root.doSubmit">Hoàn Tất</button>
            <span>quá trình đăng quảng cáo</span>
            <i class="fa fa-asterisk fa-spin fa-2x" data-bind="visible: Saving()"></i>
        </div>
    </div>
    <div style="display: none" id="upload-step2-flash">
        <div id="flashfileupload">Select Flash</div>
        <div class="form-actions form-group">
            <button type="button" class="btn btn-sm btn-default" onClick="window.location.reload()">Tải Lại Trang</button>
            <button class="btn btn-sm btn-primary" id="btn_up-flash" type="button" data-bind="click: $root.doSubmit">Hoàn Tất</button>
            <span>quá trình đăng quảng cáo</span>
            <i class="fa fa-asterisk fa-spin fa-2x" data-bind="visible: Saving()"></i>
        </div>
    </div>
    <div style="display: none" id="upload-step2-video">
        <form id="frm-video" data-bind="attr: { action: PostUrl() + '#advid=' + CurrentAdvId() }" method="post" enctype="multipart/form-data">
            <input type="file" name="file" />
            <input type="hidden" name="token" data-bind="value: Token()" />
            <button class="btn btn-sm btn-success" data-bind="click: function () { Saving(true) }" type="submit" >Đăng lên</button>
            <i class="fa fa-asterisk fa-spin fa-2x" data-bind="visible: Saving()"></i>
        </form>
    </div>
</div>
